#include "ZBAttackManager.h"

ZBAttackManager::ZBAttackManager(Game * BW)
{
	Broodwar = BW;
	lastKnownDShipPos = Position();
	lastKnownDShipTime = 0;
	dShipStatus = LOST;
	dShip = NULL;
}

int ZBAttackManager::whichBase(BWAPI::Position p)
{
	int x = p.x();
	int y = p.y();
	
	if(x >= BREDX1 && x <= BREDX2 && y >= BREDY1 && y <= BREDY2)
		return BRED;
	if(x >= BBLUEX1 && x <= BBLUEX2 && y >= BBLUEY1 && y <= BBLUEY2)
		return BBLUE;
	if(x >= BTEALX1 && x <= BTEALX2 && y >= BTEALY1 && y <= BTEALY2)
		return BTEAL;
	if(x >= BPURPLEX1 && x <= BPURPLEX2 && y >= BPURPLEY1 && y <= BPURPLEY2)
		return BPURPLE;
	if(x >= BORANGEX1 && x <= BORANGEX2 && y >= BORANGEY1 && y <= BORANGEY2)
		return BORANGE;
	if(x >= BBROWNX1 && x <= BBROWNX2 && y >= BBROWNY1 && y <= BBROWNY2)
		return BBROWN;
	return BMIDDLE;
}

void ZBAttackManager::drawDShipPosition()
{
	Broodwar->drawCircleMap(lastKnownDShipPos.x(), lastKnownDShipPos.y(), Broodwar->getFrameCount()-lastKnownDShipTime, COLOR_BLUE);
}
